<template>
	<div>
		<div style="margin-bottom: 1.25rem;cursor: pointer;" @click="work()">作业文件夹><span style="color: #b6b6b6;">{{phone.examDireName}}</span></div>
	
	<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%;overflow: auto;height: 100vh;"
	 :header-cell-style="{'background-color': '#f2f4f7'}" :cell-style="{padding:'20px 0'}">
		<el-table-column label="标号" type="index" :index="indexMethod" width="200px
		">
		</el-table-column>
		<el-table-column label="试卷名称">
			
			<template slot-scope="scope" style="display: flex;">
			<span >{{ scope.row.examName }}</span></template>
		</el-table-column>
		<el-table-column prop="examExplain" label="试卷描述">
		</el-table-column>
		<el-table-column prop="createTime" label="创建时间">
		</el-table-column>
		<el-table-column prop="address" label="创建时间" show-overflow-tooltip>
			<template slot-scope="scope">
			<el-button style="border:#03d3bd 1px solid;color: black;" 　size="mini" @click="fabu(scope.row.id)">发布</el-button>
		<!-- 	<el-button style="border:#ffab03 1px solid;color: black;" @click="check(scope.$index,scope.row)" size="mini">编辑</el-button> -->
			<el-button style="border: #ff4949 1px solid;color: black;" 　size="mini" @click="deleteExam(scope.row.id)">删除</el-button>
				
			</template>
		</el-table-column>
	</el-table>
	</div>
</template>

<script>
	import {
		HttpManager
	} from "../../../../request/Teacher.js"
	export default {

		data() {
			return {
				tableData: [],
				multipleSelection: [],
				// 表单数据
				formData: {
					// 上级文件夹id，默认全部文件最上层为0
					id: 0,
					// 搜索框内容
					search: '',
					// 是否逆序
					reverse: false
				},
				newClassMask: false,
				addstudent: false,
				activeName: 'first',
				courseId:window.localStorage.getItem("ClassId"),
			}

		},
		props:{
			phone:Object
		},
		created()
		{
		this.getExamByCourseIdAndPhone();
		},
		methods: {
			// 获取文件列表
			async getFiles() {
				// 清空被选中文件id列表
				this.checkedList = []
				console.log('获取文件列表')
				// params参数：文件夹id、搜索的值、是否逆序
				// this.files = await axios.get('/files', { params: this.formData })
			},
			handleSelectionChange() {

			},
			handleClose() {
				this.addstudent = false
			},
			handleClick(tab, event) {
				console.log(tab, event);
			},
			work(){
				this.$emit("child2-event")
			},
			getExamByCourseIdAndPhone()
			{
				HttpManager.getExamByCourseIdAndPhone(this.courseId,this.phone.phone).then(e=>{
					console.log(e);
					this.tableData=e.data.data;
				})
			},
			deleteExam(id)
			{
				HttpManager.deleteExam([id]).then(e=>{
					console.log(e);
					this.getExamByCourseIdAndPhone();
				})
			},
			fabu(id){
				localStorage.setItem("TestId",id);
				this.$router.push('/ReleaseTest');
			}

		}


	}
</script>


<style>
</style>
